package com.jojo.jojoWorld.controller;

import com.alibaba.fastjson.JSONObject;
import com.jojo.jojoWorld.entity.ZwDeptRelation;
import com.jojo.jojoWorld.entity.fujian3;
import com.jojo.jojoWorld.mapper.TreeMapper;
import com.jojo.jojoWorld.service.TreeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;


/**
 * description
 *
 * @author Lenovo
 * @return null
 */
@RestController
@RequestMapping("/api/business/tree")
public class TreeController {

    @Autowired
    private TreeService treeService;
    @Resource
    private TreeMapper treeMapper;

    @GetMapping("/hello")
    public String hello(){
        return "Hello";
    }

    @GetMapping("/getAll")
    public List<ZwDeptRelation> getAll(){
        int i = 20;
        if (i > 10){
            i++;
        } else {
            i--;
        }
        System.out.println("-------------------" + i + "-------------------");
        return treeService.getAll();
    }

    @GetMapping("/getTree")
    public List<ZwDeptRelation> getTree(){
        return treeService.getTree();
    }


    @GetMapping("/fujian3")
    public List<fujian3> getAllFujian(){
        List<fujian3> fujian3All = treeMapper.selectAll();
        List<String> hospital8 = treeMapper.selectHospital8();
        return null;
    }

}

